<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        .div1 {
            width: 100px;
            height: 100px;
            background: 20px;
        }

        button {
            padding: 10px 25px;
            border: none;
            background-color: fuchsia;
            border-radius: 5px;
        }
    </style>
</head>
<body>
<div id="app">
    <button v-on:click='fn'>toggle</button>
    <!--    v-on:可以简写成@-->
    <!--    <button @click='fn'>toggl</button>-->
    <div class="div1" v-show='bol'></div>
</div>
<script type="text/javascript">
    var vm = new Vue({
        el: '#app',
        data: {
            bol: false
        },
        methods:{
            fn:function () {
                this.bol=!this.bol;
            }
        }
    });
</script>
</body>
</html>